package mya.mes.mdc.model.record;

import com.alibaba.fastjson.JSONObject;
import mya.mes.mdc.model.tag.util.KeyBuilder;

/**
 * 设备状态
 */
public class StatusRecord {


  /**
   * mongoDb主键
   */
  public Long _id;

  public String key;

  public Long recTime;
  /**
   * 报警车间
   */
  public String shop;

  /**
   * 报警区域,如BD1/SECTION1
   */
  public String area;

  /**
   * 报警区域：如 SECTION1
   */
  public String section;

  /**
   * 报警点,如TC01 = ViewTag
   */
  public String point;
  /**
   * 扫描日期
   */
  public String statusDate;

  /**
   * 扫描时间
   */
  public String statusTime;


  /**
   * TRUE = 表示生产，FALSE =表示维护
   */
  protected Boolean prod = Boolean.TRUE;


  public StatusRecord() {
  }

  public StatusRecord(JSONObject json) {
//    StatusRecordConverter.fromJson(json, this);
    this._id = json.getLong("_id");
  }

  public JSONObject toJson() {
    JSONObject json = new JSONObject();
//    StatusRecordConverter.toJson(this, json);
    if (_id != null) {
      json.put("_id", _id);
    }
    return json;
  }

  public String buildKey() {
    if (key == null) {
      key = KeyBuilder.key(shop, area, point);

    }
    return key;
  }


  public Long get_id() {
    return _id;
  }

  public void set_id(Long _id) {
    this._id = _id;
  }

  public String getKey() {
    return key;
  }

  public void setKey(String key) {
    this.key = key;
  }

  public Long getRecTime() {
    return recTime;
  }

  public void setRecTime(Long recTime) {
    this.recTime = recTime;
  }

  public String getShop() {
    return shop;
  }

  public void setShop(String shop) {
    this.shop = shop;
  }

  public String getArea() {
    return area;
  }

  public void setArea(String area) {
    this.area = area;
  }

  public String getSection() {
    return section;
  }

  public void setSection(String section) {
    this.section = section;
  }

  public String getPoint() {
    return point;
  }

  public void setPoint(String point) {
    this.point = point;
  }

  public String getStatusDate() {
    return statusDate;
  }

  public void setStatusDate(String statusDate) {
    this.statusDate = statusDate;
  }

  public String getStatusTime() {
    return statusTime;
  }

  public void setStatusTime(String statusTime) {
    this.statusTime = statusTime;
  }

  public Boolean getProd() {
    return prod;
  }

  public void setProd(Boolean prod) {
    this.prod = prod;
  }
}
